import City from "./City";

class Person {
  private originName: string;
  private name: string;
  city: City;

  constructor(_name: string) {
    this.originName = _name;
    this.name = _name;
    this.city = new City('北京市');
  }

  setName(newName: string) {
    this.name = newName;
    return this.name;
  }

  getName() {
    return this.name;
  }

  reset() {
    this.name = this.originName;
    const originCityInfo = this.city.reset();
    return { ...originCityInfo, name: this.name };
  }
}

export default Person;
